#ifndef _SYSTEM_H_
#define _SYSTEM_H_


class CSystem
{
public:
	typedef enum
	{
		VIDEOMODE_NONE = 0,
		VIDEOMODE_2D,
		VIDEOMODE_2D3D,
		VIDEOMODE_3D
	}EVideoMode;
	
	typedef enum
	{
		MAINSCREEN_UP = 0,
		MAINSCREEN_DOWN
	}EScreenPos;
	
private:
	static CSystem __this;
	
	EVideoMode	m_videoMode;
	EScreenPos	m_screenPos;
	EScreenPos	m_targetScreenPos;
	int			m_brightness;
	int			m_targetBrightness;
	BOOL		m_isRendering;
	int			m_fov;
	
	CSystem();
	
	void vblank();
	void setup3D();
	
	friend void VBlankIntr();
protected:
public:	
	static CSystem *getInstance() {return &__this;}
	
	void initSystem();
	
	void setVideoMode(EVideoMode mode);
	EVideoMode getVideoMode() {return m_videoMode;}
	BOOL is3DMode() { return (m_videoMode == VIDEOMODE_2D3D) || (m_videoMode == VIDEOMODE_3D); }
	void setBrightness(int brightness) {m_targetBrightness = brightness;}
	int getBrightness() {return m_brightness;}
	
	void setMainPos(EScreenPos pos) {m_targetScreenPos = pos;}
	EScreenPos getMainPos() {return m_screenPos;}
	
	inline void setRendering(BOOL rendering) {m_isRendering = rendering;}
	inline BOOL isRendering() { return m_isRendering;}
	void copyScreens();
	
	void clear3DScreen(BOOL flip = FALSE);
	void flip3DScreen();
	void setFOV(int fov);
	int getFOV() { return m_fov;}
};

#endif //_SYSTEM_H_